<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
  xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
  layout:decorator="v2/layout">
  <head>
  	<script>
  	$(function() {
  		setMenu("我的评委", true);
  		
  		var date = new Date().Format("yyyy-MM");
  		$.setData({date:date})
  		
  		$("#page").page({url:"list-evaluate",data:{size:50},success:function(obj){
  			$.each(obj.obj.content, function(i,v){
  				v.beginAt = new Date(v.beginAt).Format("yyyy-MM-dd HH:mm:ss");
  				v.endAt = new Date(v.endAt).Format("yyyy-MM-dd HH:mm:ss");
  			});
  			$.setData(obj.obj);
  		}});
  		
  		$.pageReload('pageComment',{date:date});
  		$.pageReload('pageGrade',{date:date});
  	});
  	var showCommentPageData = function(list){
  		$.each(list, function(i,v){
			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm:ss");
			v.textLength = (v.text==null)?0:v.text.length;
			if(v.mediaUrl){
				var mediaTime = v.mediaUrl.match(/_d[0-9]*\./ig);
				if(mediaTime){
					v.mediaTime = mediaTime[0].replace(/(_d)|(\.)/g, "");	
				}
			}
			if(v.mediaType){
				if(v.mediaType == 'PIC'){
					v.mediaTypeDesc = "图片";
				} else if(v.mediaType == 'VOICE'){
					v.mediaTypeDesc = "语音";
				} else {
					v.mediaTypeDesc = "文字";
				}
			}
		});
		$.setData({contentComment:list});
  	}
  	var showPageData = function(list){
  		$.each(list, function(i,v){
			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm:ss");
		});
		$.setData({contentGrade:list});
  	}
  	</script>
  </head>
  <body>
	<div layout:fragment="content">
         	
       	<div class="info info-full">
    		<div class="stat">
	            <div class="stat-top">
	                <span class="stat-title"><strong>关键数据</strong></span>
	            </div>
	            <div class="stat-content">
	            	<div class="stat-row stat-btn">
		                <div data-wyx-class="stat-group {type==''?'active':''}" onclick="$.setData({type:''});">
		                    <div class="stat-group-title">关联比赛数量</div>
		                    <div class="stat-group-count"><strong th:text="${evaluateCount}"></strong></div>
		                </div>
		                <div data-wyx-class="stat-group {type=='comment'?'active':''}" onclick="$.setData({type:'comment'});">
		                    <div class="stat-group-title">点评数量(当月点评总数量)</div>
		                    <div class="stat-group-count"><strong th:text="${blogCommentMothCount}"></strong></div>
		                </div>
		                <div data-wyx-class="stat-group {type=='grade'?'active':''}" onclick="$.setData({type:'grade'});">
		                    <div class="stat-group-title">打分数量(当月打分总数量)</div>
		                    <div class="stat-group-count"><strong th:text="${blogGradeMothCount}"></strong></div>
		                </div>
	                </div>
	            </div>
	
	        </div>
    	</div>
    	
    	<div class="search">
    		<div class="search-item">
    			<div class="search-control">
    				<input class="search-text" id="date" readonly="readonly" data-wyx-value="{date}" onfocus="WdatePicker({dateFmt: 'yyyy-MM'})" placeholder="日期" type="text">
    			</div>
    			<div class="search-btn">
    				<span class="search-button" onclick="$.pageReload('pageComment',{date:$('#date').val()});$.pageReload('pageGrade',{date:$('#date').val()});">查询</span>
    			</div>
    		</div>
    	</div>
       	
		<div class="info info-full">
			
			<div class="detail-table">
      				<h4 class="detail-table-title">
					详细数据
					<span class="detail-table-more"></span>
				</h4>
			    <div class="table_list">
			    	<div class="table-overflow" data-wyx-if="{type==''}">
	                   <table class="table">
	                       <thead>
	                           <tr>
	                            <th>比赛名称</th>
	                            <th>比赛ID</th>
	                            <th>开始时间</th>
	                            <th>结束时间</th>
	                            <th>总贴数量</th>
	                            <th>备注</th>
	                           </tr>
	                       </thead>
	                       <tbody>
								<tr data-wyx-for="{data : content}">
									<td data-wyx-text="{data.title}"></td>
									<td data-wyx-text="{data.id}"></td>
									<td data-wyx-text="{data.beginAt}"></td>
									<td data-wyx-text="{data.endAt}"></td>
									<td data-wyx-text="{data.blogCount}"></td>
									<td data-wyx-text="{data.remarks}"></td>
								</tr>
	                     </tbody>
	                 </table>
	                 <div id="page"></div>
	          	</div>
	          	
	          	<div class="table-overflow" data-wyx-elif="{type=='comment'}">
	                   <table class="table">
	                       <thead>
	                           <tr>
	                            <th>学生姓名</th>
	                            <th>用户ID</th>
	                            <th>比赛名称</th>
	                            <th>点评时间</th>
	                            <th>点评类型</th>
	                            <th>点评内容</th>
	                            <th>点评字数</th>
	                            <th>点评语音(秒)</th>
	                           </tr>
	                       </thead>
	                       <tbody>
								<tr data-wyx-for="{data : contentComment}">
									<td data-wyx-text="{data.userName}"></td>
									<td data-wyx-text="{data.userNumber}"></td>
									<td data-wyx-text="{data.evaluateTitle}"></td>
									<td data-wyx-text="{data.createdAt}"></td>
									<td data-wyx-text="data.mediaTypeDesc"></td>
									<td data-wyx-text="{data.text}"></td>
									<td data-wyx-text="{data.textLength}"></td>
									<td data-wyx-text="{data.mediaTime}"></td>
								</tr>
	                     </tbody>
	                 </table>
	                 <div data-page="pageComment" data-page-action="list-comment" data-page-data="size=200" data-page-csv_apply="$.showCommentPageData()"  data-page-success="$.showCommentPageData()" 
	                 data-page-csv_title="userName(学生姓名),userNumber(用户ID),evaluateTitle(比赛名称),createdAt(点评时间),mediaTypeDesc(点评类型),text(点评内容),textLength(点评字数),mediaTime(点评语音[秒])"></div>
	          	</div>
	          	<div class="table-overflow" data-wyx-elif="{type=='grade'}">
	                   <table class="table">
	                       <thead>
	                           <tr>
	                            <th>学生姓名</th>
	                            <th>用户ID</th>
	                            <th>比赛名称</th>
	                            <th>打分时间</th>
	                            <th>打分</th>
	                            <th>第几个打分</th>
	                            <th></th>
	                           </tr>
	                       </thead>
	                       <tbody>
								<tr data-wyx-for="{data : contentGrade}">
									<td data-wyx-text="{data.userName}"></td>
									<td data-wyx-text="{data.userNumber}"></td>
									<td data-wyx-text="{data.evaluateTitle}"></td>
									<td data-wyx-text="{data.createdAt}"></td>
									<td data-wyx-text="{data.point}"></td>
									<td data-wyx-text="{data.gradeIndex}"></td>
									<td>
										<a target="_blank" data-wyx-href="{serverH5Url}/blogs/blog/{data.blogId}">帖子</a>
									</td>
								</tr>
	                     </tbody>
	                 </table>
	                 <div data-page="pageGrade" data-page-action="list-grade" data-page-data="size=200" data-page-csv_apply="$.showPageData()" data-page-success="$.showPageData()" 
	                 data-page-csv_title="userName(学生姓名),userNumber(用户ID),evaluateTitle(比赛名称),createdAt(打分时间),point(打分),gradeIndex(第几个打分)"></div>
	          	</div>
	          </div>
          </div>
			
    	</div>
       			
          
	
	</div>
  </body>
</html>